﻿using System.Linq;

namespace IGMVC.Web.Models
{
    public class IssueRepository : FakeRepository<Issue>
    {
        public int GetExtremelySevereIssueCount()
        { 
            return (from i in this.List where i.Severity == 5 select i).Count();
        }

        public int GetSomewhatSevereIssueCount()
        {
            return (from i in this.List where i.Severity == 4 select i).Count();        
        }

        public int GetModeratelySevereIssueCount()
        {
            return (from i in this.List where i.Severity == 3 select i).Count();
        }

        public int GetLowSevereIssueCount()
        {
            return (from i in this.List where i.Severity == 2 select i).Count();
        }

        public int GetNotSevereIssueCount()
        {
            return (from i in this.List where i.Severity == 1 select i).Count();
        }

        public int GetMinimumSeverityValue()
        {
            return 1;
        }

        public int GetMaximumSeverityValue()
        {
            return 5;
        }

        public void AddFakeData()
        {
            if (!this.HasItems)
            {
                this.Insert(new Issue() { Title = "Breakpoints Show Up on Wrong Line", Description = "After adding a breakpoint to the right line, when the debuger breaks, the line the IDE stops on is on the wrong line.", Severity = 5, IssueTypeId = 2 });
                this.Insert(new Issue() { Title = "Tooltips Delayed", Description = "When hovering over a control the tool tip takes a long time to appear.", Severity = 2, IssueTypeId = 1 });
                this.Insert(new Issue() { Title = "Save Dialog Buttons Misaligned", Description = "The 'OK' and 'Cancel' buttons are not lined up correctly in the Save dialog.", Severity = 1, IssueTypeId = 1 });
                this.Insert(new Issue() { Title = "Help Viewer Does Not Load Tree View", Description = "The left-hand tree view does not load when opening up help files.", Severity = 5, IssueTypeId = 3 });
                this.Insert(new Issue() { Title = "Object Visualizer Hides Properties", Description = "When drilling into an object's properties during a debugging session the visualizer stops at 10 properties.", Severity = 4, IssueTypeId = 2 });
                this.Insert(new Issue() { Title = "Unable to Redisplay Watch Window", Description = "If you accidentally close the watch window during a debug session you can't get it back.", Severity = 4, IssueTypeId = 2 });
                this.Insert(new Issue() { Title = "Server Explorer Disappears", Description = "At random times, if you click on the Server Explorer tab, the IDE starts to spin and the the tab disappears. A small box where the tab used to be remains, but you can't get the it back without rolling back to installed preferences.", Severity = 5, IssueTypeId = 1 });
                this.Insert(new Issue() { Title = "Expression Window Inoperable", Description = "Expression window will not let you type code to execute during debugging.", Severity = 5, IssueTypeId = 2 });
                this.Insert(new Issue() { Title = "Pink Breakpoints are Just Wrong", Description = "Breakpoints show up as pink, not red.", Severity = 3, IssueTypeId = 2 });
                this.Insert(new Issue() { Title = "Misspelling in Help Introduction", Description = "Has 'welcoem' instead of 'welcome'.", Severity = 3, IssueTypeId = 3 });
                this.Insert(new Issue() { Title = "About Dialog Missing Linked Url", Description = "The about dialog has our url, but it is not clickable.", Severity = 2, IssueTypeId = 1 });
                this.Insert(new Issue() { Title = "Help Headeer Images Not Loading", Description = "The header images on help files do not load", Severity = 1, IssueTypeId = 3 });
                this.Insert(new Issue() { Title = "Stack Trace Visualizer has Extra Whitespace", Description = "When viewing a stack trace, there is a long section of white space after the stack. This makes the window appear as if the stack is huge.", Severity = 2, IssueTypeId = 2 });
                this.Insert(new Issue() { Title = "Can not Switch to Replace from Find Dialog", Description = "When opening find with CTL-F you can not automatically switch to the replace dialog by then hitting CTL-H.", Severity = 5, IssueTypeId = 1 });
            }
        }
    }
}
